


pub fn search(nums: Vec<i32>, target: i32) -> i32 {
  let mut l: usize = 0;
  let mut r = nums.len();
  let mut m: usize = (l + r) / 2;
  while l<m {
      if nums[m] == target {
          return m as i32;
      }
      match nums[m] - target > 0 {
          true => {
              r = m;
              
          }
          false => {
              l = m;
          }
      }
      m = (l + r) / 2;
  }
  return if nums[m] == target { m as i32 } else { -1 };
}